package org.lex.filter;

/**
 * a simple filter always returns true, or always return false depends on the
 * boolean value in constructor
 * 
 * @author Daniel Liu
 */
public class ConstantsFilter<T> extends BooleanRelatedFilter implements Filter<T> {
	public static final Filter ACCEPT_ALL = new ConstantsFilter(true);
	public static final Filter REJECT_ALL = new ConstantsFilter(false);

	private static final String DEFAULT_TRUE = "Accept All";
	private static final String DEFAULT_FALSE = "Reject All";

	public ConstantsFilter(boolean value) {
		this(value, value ? DEFAULT_TRUE : DEFAULT_FALSE);
	}

	public ConstantsFilter(boolean value, String description) {
		super(value, description);
	}

	public boolean accept(T o) {
		return this.value;
	}

	public boolean getReturnValue() {
		return this.value;
	}
}
